const app = getApp();
const baseURL = app.globalData.baseURL

Page({
  data: {
    user: {}
  },
  logout() {
    wx.removeStorageSync('token')
    wx.navigateTo({
      url: '/pages/login/login',
    })
  },
  toReservationrecord() {
    wx.navigateTo({
      url: '/pages/reservationrecord/reservationrecord',
    })
  },
  toMyCourse() {
    wx.navigateTo({
      url: '/pages/myCourse/myCourse',
    })
  },
  toRecharge() {
    wx.navigateTo({
      url: '/pages/recharge/recharge',
    })
  },
  toUserInfo() {
    wx.navigateTo({
      url: '/pages/userInfo/userInfo',
    })
  },
  onLoad(option) {
    wx.request({
      url: `${baseURL}/user/user/selOne`,
      method: 'POST',
      header: {
        "Authorization": 'Bearer ' + wx.getStorageSync('token')
      },
      success: (res) => {
        this.setData({
          user: res.data.data
        })
      }
    })
  }
})